Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add stats for shopify Id resolution #2885

Merged
merged 1 commit into from
Dec 7, 2023

Conversation

anantjain45823
Copy link
Contributor

@anantjain45823 anantjain45823 commented Dec 7, 2023

What are the changes introduced in this PR?

Adding shopify ID Resolution stats based on shopifyTopic and method

Write a brief explainer on your code changes.
Added some stats to check from where the ID is getting resolved either from note_attributes sent by shopify or from our db event wise

Please explain the objectives of your changes below

This will help us to know if we can remove the mapping in db after a particular event has taken place (Order Created)

Put down any required details on the broader aspect of your changes. If there are any dependent changes, mandatorily mention them here

Type of change

Chore

  • Existing capabilities/behavior

  • New capabilities/behavior

If the pull request is a new feature,

Any technical or performance related pointers to consider with the change?

N/A

Any new dependencies introduced with this change?

N/A

Any new generic utility introduced or modified. Please explain the changes.

N/A

If the PR has changes in more than 10 files, please mention why the changes were not split into multiple PRs.

N/A

If multiple linear tasks are associated with the PR changes, please elaborate on the reason:

N/A


Developer checklist

  • No breaking changes are being introduced.

  • Are all related docs linked with the PR?

  • Are all changes manually tested?

  • Does this change require any documentation changes?

  • Are relevant unit and component test-cases added?

Reviewer checklist

  • Is the type of change in the PR title appropriate as per the changes?

  • Verified that there are no credentials or confidential data exposed with the changes.

Summary by CodeRabbit

  • New Features

    • Introduced a new metric to monitor Shopify anonymous ID resolution processes.
  • Enhancements

    • Improved the event processing to include additional Shopify topic information.
  • Bug Fixes

    • Adjusted anonymous ID resolution tracking to accurately reflect different resolution methods.

@anantjain45823 anantjain45823 self-assigned this Dec 7, 2023
@anantjain45823 anantjain45823 requested review from a team as code owners December 7, 2023 05:02
Copy link
Contributor

coderabbitai bot commented Dec 7, 2023

Walkthrough

The changes involve the introduction of a new metric to track Shopify anonymous ID resolutions within a Prometheus class, and updates to the getAnonymousIdAndSessionId function to increment this metric. The metric is incremented when resolving IDs using 'note_attributes' and 'database' methods. Additionally, the processEvent function in the Shopify transform logic has been updated to pass additional data when calling getAnonymousIdAndSessionId.

Changes

File Path Change Summary
src/util/prometheus.js Added new 'shopify_anon_id_resolve' counter metric to Prometheus class.
src/v0/.../shopify/transform.js Updated processEvent to pass an object containing shopifyTopic and metricMetadata to getAnonymousIdAndSessionId.
src/v0/.../shopify/util.js Modified getAnonymousIdAndSessionId to increment 'shopify_anon_id_resolve' metric for 'note_attributes' and 'database' methods.

Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • If you reply to a review comment from CodeRabbit, the bot will automatically respond.
  • To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment
  • Note: Review comments are made on code diffs or files, not on the PR overview.
  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Note: For conversation with the bot, please use the review comments on code diffs or files.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

@anantjain45823
Copy link
Contributor Author

@coderabbitai review

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between e1714bd and 35100ba.
Files selected for processing (3)
  • src/util/prometheus.js (1 hunks)
  • src/v0/sources/shopify/transform.js (1 hunks)
  • src/v0/sources/shopify/util.js (2 hunks)
Additional comments: 6
src/util/prometheus.js (1)
  • 487-495: The addition of the 'shopify_anon_id_resolve' metric with label names ['method', 'writeKey', 'shopifyTopic'] aligns with the PR objectives and the summary provided.
src/v0/sources/shopify/transform.js (3)
  • 175-181: The changes to the getAnonymousIdAndSessionId function call to include shopifyTopic in the object along with metricMetadata align with the PR objectives and the provided summaries. This ensures that the metric tracking for Shopify ID resolution includes the topic of the Shopify event, which is crucial for the new metrics being introduced.

  • 175-181: The logic for setting anonymousId and sessionId on the message object after resolving them through getAnonymousIdAndSessionId is consistent with the expected behavior for tracking and is not mentioned as changed in the summary. This suggests that the behavior is preserved from the previous implementation, which is good for maintaining existing functionality while adding the new metric tracking.

  • 175-181: > Note: This review was outside the patches, and no patch overlapping with it was found. Original lines [1-174]

The rest of the file appears to be consistent with the PR objectives and the summaries provided. There are no additional changes that would affect the new metric tracking functionality or any other existing functionality.

Also applies to: 182-308

src/v0/sources/shopify/util.js (2)
  • 164-171: The addition of metric incrementation based on the 'note_attributes' method is consistent with the PR objectives to track the resolution of Shopify IDs.

  • 195-204: The addition of metric incrementation based on the 'database' method aligns with the PR objectives to differentiate the source of ID resolution.

Copy link

sonarqubecloud bot commented Dec 7, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@anantjain45823 anantjain45823 merged commit 7131791 into develop Dec 7, 2023
20 checks passed
@anantjain45823 anantjain45823 deleted the chore.addShopifyAnonIdResolveStat branch December 13, 2023 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants